package com.atguigu.pratice;

import java.util.Scanner;

public class TheDayOfThisYear {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int year=scanner.nextInt();
        int month=scanner.nextInt();
        int day=scanner.nextInt();
        boolean flag=false;
        if((year%400==0)||(year%4==0&&year%100!=0)){
            flag=true;
        }
        int res=0;
        switch (month){
            case 1:res+=day;
            break;
            case 2:res=res+day+31;
            break;
            case 3:res=res+day+31+28;
            break;
            case 4:res=res+day+31+31+28;
            break;
            case 5:res=res+day+31+28+31+30;
            break;
            case 6:res=res+day+31+28+31+30+31;
            break;
            case 7:res=res+day+31+28+31+30+31+30;
            break;
            case 8:res=res+day+31+28+31+30+31+30+31;
            break;
            case 9:res=res+day+212+31;
            break;
            case 10:res=res+day+212+31+30;
            break;
            case 11:res=res+day+212+31+30+31;
            break;
            case 12:res=res+day+212+31+30+31+30;
            break;
        }
        if(flag&&month>=3){
            res++;
        }
        System.out.println(res);
    }
}
